package leetcode2;

public class Day3 {


    public static void main(String[] args) {
        char ch = 'a';
        System.out.println((int)ch);
    }

    //712.两个字符串的最小ascii值
    public int minimumDeleteSum(String s1, String s2) {
        //1.
        int m=s1.length(),n=s2.length();
        int sum=0;
        for(int i=0;i<m;i++) {
            sum += (int)s1.charAt(i);
        }
        for(int i=0;i<n;i++) {
            sum += (int)s2.charAt(i);
        }
        int[][] dp = new int[m+1][n+1];
        for(int i=1;i<=m;i++) {
            for(int j=1;j<=n;j++) {
                if(s1.charAt(i-1)==s2.charAt(j-1)) {
                    dp[i][j]=Math.max(dp[i-1][j-1] + (int)s1.charAt(i-1),dp[i][j]);
                }
                dp[i][j]=Math.max(dp[i][j],dp[i-1][j]);
                dp[i][j]=Math.max(dp[i][j],dp[i][j-1]);
            }
        }
        return sum - dp[m][n]*2;
    }

}
